<template>
    <div class="not-found-container" :class="{ 'dark-mode': isDarkMode }">
        <div class="not-found-content glass-effect">
            <div class="error-icon">
                <svg width="120" height="120" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
                    <path d="M12 14C12.5523 14 13 13.5523 13 13C13 12.4477 12.5523 12 12 12C11.4477 12 11 12.4477 11 13C11 13.5523 11.4477 14 12 14Z" fill="currentColor"/>
                    <path d="M12 7V11" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
                    <path fill-rule="evenodd" clip-rule="evenodd" d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z" fill="currentColor"/>
                </svg>
            </div>
            <h1 class="error-code">404</h1>
            <h2 class="error-title">页面未找到</h2>
            <p class="error-message">抱歉，您访问的页面不存在或已被移除</p>
            <button class="apple-button" @click="goHome">返回首页</button>
        </div>
    </div>
</template>

<script>
export default {
    name: 'NotFound',
    data() {
        return {
            isDarkMode: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
        }
    },
    mounted() {
        this.detectColorScheme();
        window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', this.detectColorScheme);
    },
    beforeDestroy() {
        window.matchMedia('(prefers-color-scheme: dark)').removeEventListener('change', this.detectColorScheme);
    },
    methods: {
        detectColorScheme() {
            this.isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
        },
        goHome() {
            this.$router.push('/');
        }
    }
}
</script>

<style scoped>
/* 基础设置 */
.not-found-container {
    height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #F5F5F7; /* 苹果浅色背景 */
    padding: 24px;
    color: #1D1D1F;
    transition: background-color 0.3s, color 0.3s;
}

.dark-mode {
    background-color: #1C1C1E; /* 苹果深色背景 */
    color: #FFFFFF;
}

.not-found-content {
    text-align: center;
    max-width: 500px;
    padding: 48px;
    border-radius: 24px;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.dark-mode .not-found-content {
    background-color: rgba(44, 44, 46, 0.8);
}

.glass-effect {
    backdrop-filter: blur(20px);
}

.error-icon {
    margin-bottom: 24px;
    color: #007AFF;
}

.dark-mode .error-icon {
    color: #0A84FF;
}

.error-code {
    font-family: -apple-system, BlinkMacSystemFont, 'San Francisco', sans-serif;
    font-size: 80px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(90deg, #007AFF, #34C759);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.dark-mode .error-code {
    background: linear-gradient(90deg, #0A84FF, #30D158);
    -webkit-background-clip: text;
}

.error-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

.error-message {
    font-size: 18px;
    color: #86868B;
    margin: 0 0 32px 0;
    line-height: 1.5;
}

.dark-mode .error-message {
    color: #98989D;
}

.apple-button {
    padding: 12px 24px;
    background-color: #007AFF;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.dark-mode .apple-button {
    background-color: #0A84FF;
}

.apple-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 122, 255, 0.3);
}

.dark-mode .apple-button:hover {
    box-shadow: 0 4px 8px rgba(10, 132, 255, 0.3);
}

.apple-button:active {
    transform: translateY(0);
}
</style>